home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 52
/
Amiga Format AFCD52 (Issue 136, May 2000).iso
/
-serious-
/
programming
/
basic
/
mildred
/
mildred.lha
/
lha
/
SplitTests.lha
/
SpeedTest4.ascii
< prev
next >
Wrap
Text File
|
2000-02-23
|
3KB
|
145 lines
WBStartup
#Objects=250
MReserveShapes #Objects+1
.init
InitBank 0,1280*512,$10000
CludgeBitMap 0,1280,512,8,Bank(0)
InitPalette 0,256
LoadBitMap 0,"Pic.128",0
MBitmap 0,1280,960
MBitmapWindow 0,1,0,960-512,1280,512
MPlanar16ToBitmap 1,Bank(0),1280,512,1280,512
MBitmap 2,1280,960
MBlockScroll 0,0,1280,960,0,0,0 ; Make backup
InitBank 0,320*240,$10002
CludgeBitMap 0,320,240,8,Bank(0)
InitBank 1,320*240,$10002
CludgeBitMap 1,320,240,8,Bank(1)
Screen 0,0,0,320,240,8,0,"Game",0,0,0
ShowPalette 0
.offsets
MBitmap 1,320,240
NEWTYPE.OffsetList
LineWidth.w
X1Offset.w
X2Offset.w
SourceModuloOffset.w
End NEWTYPE
Dim leftrows1.OffsetList(40)
Dim leftrows2.OffsetList(40)
Dim rightrows1.OffsetList(40)
Dim rightrows2.OffsetList(40)
leftrows1(0)\LineWidth=64-24,0,0,0
leftrows2(0)\LineWidth=64,0,0,0
rightrows1(0)\LineWidth=1,0,0,0
rightrows2(0)\LineWidth=24,0,0,0
For y=1 To 39
leftrows1(y)\LineWidth=64-24-y
leftrows1(y)\X1Offset=0
leftrows1(y)\X2Offset=0
leftrows1(y)\SourceModuloOffset=0
leftrows2(y)\LineWidth=64-y
leftrows2(y)\X1Offset=0
leftrows2(y)\X2Offset=0
leftrows2(y)\SourceModuloOffset=0
rightrows1(y)\LineWidth=y+1
rightrows1(y)\X1Offset=-1
rightrows1(y)\X2Offset=-1
rightrows1(y)\SourceModuloOffset=0
rightrows2(y)\LineWidth=24+y
rightrows2(y)\X1Offset=-1
rightrows2(y)\X2Offset=-1
rightrows2(y)\SourceModuloOffset=0
Next
.setup
mousemult.q=1070/320
its.l=0
buf.b=0
;Set up movement table
.table
MQueue 0,#Objects
NEWTYPE.xy
x.w
y.w
End NEWTYPE
MParticleMode 0
Dim xy.xy(#Objects)
Dim direction.xy(#Objects)
MAutoCookie On
MUseBitmap 0
For obj=1 To #Objects
MGetaShape obj,Rnd(1280-64),760+Rnd(200-64),32,32
xy(obj)\x=Rnd(1280-96)+16
xy(obj)\y=Rnd(960-96)+16
Repeat
direction(obj)\x=Rnd(12)-6
Until direction(obj)\x<>0
Repeat
direction(obj)\y=Rnd(12)-6
Until direction(obj)\y<>0
Next obj
MHandle 0,32,32
Mc2pWindow 0,160,120,1280,320,240
mag.q=12
ShowBitMap 1-buf
VWait
ResetTimer
.loop
Repeat
player1x=SMouseX*mousemult
player1y=SMouseY*mousemult
player2x=(1280-238)-player1x
player2y=(960-160)-player1y
;player2x=player1x
;player2y=player1y
MUseBitmap 0
MAddToParticles &xy(1)\x,#Objects,&direction(1)\x
MReboundParticles &xy(1)\x,#Objects,&direction(1)\x,48
For obj=1 To #Objects
If xy(obj)\x>player1x-32 AND xy(obj)\x<player1x+320+32 AND xy(obj)\y>player1y-32 AND xy(obj)\y<player1y+240+32
MQBlit obj,xy(obj)\x,xy(obj)\y
EndIf
Next obj
MUseBitmap 1
Mc2p 0,MBitmapPtr(player1x,player1y,0),Bank(buf)
Mc2p 0,MBitmapPtr(player2x,player2y,0),MGenericPtr(160 LSR 3,0,Bank(buf),40)
Mc2p 0,MBitmapPtr(1280-player1x,player1y,0),MGenericPtr(0,120,Bank(buf),40)
Mc2p 0,MBitmapPtr(1280-player2x,960-player2y,0),MGenericPtr(160 LSR 3,120,Bank(buf),40)
its+1
ShowBitMap buf
; VWait
buf=1-buf
If Joyb(0)=1 Then mag-0.1
If Joyb(0)=2 Then mag+0.1
MUnQueue 0,2
Until Joyb(0)=3
;Report
.report
t=Timer
t=Max(t,1)
its=Max(its,1)
a.q=50.0/(t/its)
WBenchToFront_
WbToScreen 1
Window 2,16,16,300,40,0,"Test results",1,0
WindowOutput 2
NPrint a," frames per second"
NPrint " "
NPrint "Press mouse/joy button..."
VWait 20
Repeat
Until Joyb(0)<>0 OR Joyb(1)<>0
End